/**
 *  @file highScoreController.cpp
 *
 *  @date 22-dec-2009
 *  @author Ives van der Flaas
 */

#include <iostream>
#include "highScoreController.h"

namespace si
{

HighScoreController::HighScoreController(
		std::tr1::shared_ptr<HighScoreModel> hsModel,
		std::tr1::shared_ptr<HighScoreView> view):
			fModel(hsModel),
			fView(view)
{

	fModel->load();

	update();

}

void HighScoreController::draw()
{
	fView->draw();
}

void HighScoreController::update()
{
	std::pair<std::vector<std::string>, std::vector<int> > scores = fModel->getVectors();

	fView->setText(scores.first, scores.second);
}
void HighScoreController::addHighScore(std::string name, int score)
{
	fModel->addEntry(name, score);
	update();
}
HighScoreController::~HighScoreController()
{
	fModel->save();
}

}
